import java.util.*;

class Room180405214 {
    static public Date newDate(int yy,int mm,int dd) {
        return new Date(yy-1900,mm-1,dd);
    }

    private Integer room_id;
    private Date begindate;
    private Date enddate;

    Room180405214(int room_id, Date d1, Date d2) {
        this.room_id=room_id;
        this.begindate=d1;
        this.enddate=d2;
    }

    @Override
    public int hashCode() {
        return this.room_id.intValue();
    }

    @Override
    public String toString() {
        return this.room_id.toString()+" "+this.begindate.toString()+" "+this.enddate.toString();
    }

    @Override
    public boolean equals(Object o) {
        Room180405214 ro=(Room180405214)o;
        return this.room_id.equals(ro.room_id);
    }
}

class Tester {
    static public String name="计算机1802";
    private HashSet<Room180405214> allRoom;
    Tester() { this.allRoom=new HashSet<Room180405214>(); }

    public void add(Room180405214 r) {
        System.out.println(r);
        if(allRoom.add(r)==false)
            System.out.println("房间已存在");
        else
            System.out.println("预订成功");
    }

    public void delete(int room_id) {
        allRoom.remove(new Room180405214(room_id,new Date(),new Date()));
    }

    public void forEach() {
        for (var i : allRoom)
            System.out.println(i);
        System.out.println("END");
    }

    public void testMain() {
        Date d1=Room180405214.newDate(2020, 1, 1);
        Date d2=Room180405214.newDate(2020, 1, 2);
        this.add(new Room180405214(302,d1,d2));
        this.add(new Room180405214(302,d1,d2));
        this.add(new Room180405214(301,d1,d2));
        forEach();
        this.delete(302);
        forEach();
    }

    public void outputClass() {
        System.out.println(Room180405214.class.getName());
        System.out.println(name);
    }
}

public class test5 {
    public static void main(String[] args) {
        Tester t=new Tester();
        t.testMain();
        t.outputClass();
    }
}